package com.anjie.powerproject.repository;

import com.anjie.powerproject.entity.PreDataHour;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.math.BigDecimal;
import java.util.List;

public interface PreDataHourRepository extends JpaRepository<PreDataHour, Integer> {

    /**
     * 根据设备ID和时间读取点位的预测数据,时间升序排列
     */
    @Query(nativeQuery = true, value = "SELECT data FROM pre_data_hour WHERE CAST(sdate as DATE)=?1 and device_code=?2 and graph_id=?3 and  stgy_type=?4 ORDER BY sdate ASC")
    List<BigDecimal> getPreDataHourValueByCodeAndDateAndGraphIdAndType(String date, String deviceCode, Integer graphId, Integer stgyType);

}
